<div ng-include src="'tpl/public/header.html'"></div> 
<div class="contents">
  <ol class="breadcrumb"> 
    <li><a href="#/index/panel">首页</a></li>
     <li class="active">外场<span ng-if="config.productType=='02'">信托</span><span ng-if="config.productType=='03'">资管</span><span ng-if="config.productType=='06'">PE/VC</span>
     <span ng-if="config.productType=='05'">私募</span></li>
  </ol>
  <form class="form-inline search-box" name="form" role="form" ng-submit="search()" novalidate>
    <div class="form-group">
      <label class="sr-only" >产品名称</label>
      <input type="text" class="form-control" placeholder="产品名称" ng-model="searchMap.productName">    </div>
    <div class="form-group">
      <label class="sr-only" >产品上传人</label>
      <input type="text" class="form-control" placeholder="产品上传人" ng-model="searchMap.name">
    </div>
    <div class="form-group">
      <label class="sr-only" >产品上传人手机号码</label>
      <input type="text" class="form-control" placeholder="产品上传人手机号码" ng-model="searchMap.mobile">
    </div>
     <div class="form-group">
      <select class="form-control" placeholder="审核状态" ng-model="searchMap.checkStatus" ng-options="m.value as m.text for m in dictMap.outProCheckStatusModel" ><option value="">--选择审核状态--</option></select> 
    </div>
    <div class="form-group" ng-class="{'has-error':form.scDate.$invalid}">
      <input type="date" class="form-control" name="scDate" placeholder="产品上传时间：2015-01-01"
       ng-model="searchMap.scDate"  ng-pattern="/^\d{4}-\d{2}-\d{2}$/" maxlength="10">
    </div>
    <button type="submit" class="btn btn-primary">查询</button>
    <button class="btn btn-primary" style="margin-left:10px;" ng-click="sendEmail();">发邮件</button>
  </form>
  <div>
    
  </div>
  <table class="table table-striped table-hover">
    <thead>
      <tr>
        <th width="30"><input type="checkbox" name="chkProjectAll" id="chkProjectAll" ng-click="chkProjectAll();" /></th>
        <th width="50" ng-click="orderby('id')" class="cur-p">ID</th>
        <th width="150">产品名称</th>
        <th width="150">产品来源</th>
        <th width="150">返佣方式</th>
        <th width="150">产品佣金</th>
        <th width="80">产品上传人</th>
        <th width="80">上传人手机</th>
        <th width="80">上传时间</th>
        <th width="80">产品状态</th>
        <th width="80">产品资料</th>
        <th width="100">操作</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="product in list">
        <td>
          <input ng-if="product.checkStatus>=4" type="checkbox" name="chkProject" accessId="{{product.pId}}" value="{{product.pId}}" />
          &nbsp;
        </td>
        <td>{{product.id}}</td>
        <td>
          <a ng-if="showProductName(config.productType,product.pId)==0"
            href="#/product/edit?id={{product.pId}}&t={{config.productType}}">
              {{product.productName}}
          </a>
          <a ng-if="showProductName(config.productType,product.pId)==1"
            href="#/pevcproduct/edit?id={{product.pId}}&t={{config.productType}}">
              {{product.productName}}
          </a>
          <a ng-if="showProductName(config.productType,product.pId)==2"
            href="#/simu/baseinfo?id={{product.pId}}&jjbm={{product.jjbm}}&t={{config.productType}}">
              {{product.productName}}
          </a>
          <span ng-if="showProductName(config.productType,product.pId,product.checkStatus)==3">{{product.productName}}</span>
        </td>
        <td>{{product.productSource}}</td>
        <td>{{product.rebateType | rebateTypeFilter}}</td>
        <td ng-if="product.rebateType!=1">  {{product.rebateRate|ratefilter}}</td>
        <td ng-if="product.rebateType==1">
          <table>
            <tr ng-repeat="a in product.rebateRebateJson">
              <td> {{a.rangeBegin}}万 -  {{a.rangeEnd}}万   {{a.rate|ratefilter}}</td>
            </tr>
          </table>
        </td>
        <td>{{product.name}}</td>
        <td><a href="#/personalsupplier/detail?id={{product.supplierId}}" target="_blank">{{product.mobile}}</a></td>
        <td>{{product.createDate | date:'yyyy-MM-dd HH:mm:ss' }}</td>
        <td>
        <!-- ng-click="showReson(product.failReson)"-->
           <a ng-if="product.checkStatus==3">不通过</a>
           <a ng-if="product.checkStatus==6">发布失败</a>
           <span ng-if="product.checkStatus!=3&&product.checkStatus!=6">{{product.checkStatus | checkStatusRender}}</span>
        </td>
        <td><a href="{{staticHost}}{{product.productAttr}}" ng-show="product.productAttr">资料下载</a></td>
        
        <td class="optd">
          <a href="#/outproduct/detail?id={{product.id}}&type={{config.productType}}">查看详情</a>
          <a ng-if="product.checkStatus==0" class="btn btn-primary" ng-click="changeStatus(product.id,1)">审核中</a>
          <a ng-if="product.checkStatus==0||product.checkStatus==1" class="btn btn-primary" ng-click="changeStatus(product.id,2)">审核通过</a>
          <a ng-if="product.checkStatus==0||product.checkStatus==1" class="btn btn-primary" ng-click="changeStatus(product.id,3)">审核不通过</a>
          <a ng-if="product.checkStatus==2" class="btn btn-primary" ng-click="changeStatus(product.id,4)">已发布</a>
          <a ng-if="product.checkStatus==2" class="btn btn-primary" ng-click="changeStatus(product.id,6)">发布失败</a>
          <a ng-if="product.checkStatus==4" class="btn btn-primary" ng-click="changeStatus(product.id,5)">已成立</a>
          <a ng-if="product.checkStatus==2&&showProductPush(config.productType,product.pId)==0" href="#/product/add?t={{config.productType}}&outProductId={{product.id}}&productName={{product.productName}}">发布</a>
          <a ng-if="product.checkStatus==2&&showProductPush(config.productType,product.pId)==1" href="#/pevcproduct/add?t=06&outProductId={{product.id}}&productName={{product.productName}}">发布</a>
          <a ng-if="product.checkStatus==2&&showProductPush(config.productType,product.pId)==2" href="#/simu/add?t=05&outProductId={{product.id}}&productName={{product.productName}}">发布</a>
        </td>
      </tr>
    </tbody>
  </table>
</div>
<div class="pager-box" ng-include src="'tpl/public/pager.html'" ng-show="list.length > 0"></div>


<div class="layer-box" ng-show="showEstablishaFormFlag">
  <div class="layer-bg"></div>
  <div class="layer-con " style="padding:10px 20px;">
    <span class="icons-close" title="关闭" ng-click="showEstablishaFormFlag = false;">X</span>
    <ul style="text-align: left;">
      <li>
        <input type="radio" name="failReson" ng-click="param.failReson='已有此产品'" />已有此产品
      </li>
      <li>
          <input type="radio" name="failReson" ng-click="param.failReson='无效产品'" />无效产品
      </li>
      <li>
          <input type="radio" name="failReson" ng-click="param.failReson='资料信息不全无法上架'" />资料信息不全无法上架
      </li>
      <li>
        <input type="radio" name="failReson" ng-click="param.failReson='产品类型暂不支持上架'" />产品类型暂不支持上架
      </li>
    </ul>
    <div class="layer-title" >
      失败原因
    </div>
    <div class="con-wrap">
      <form class="form-horizontal" role="form" name="estagForm" novalidate ng-submit="changeStatus(pId,3)">
        <div class="form-group" ng-class="{'has-error':estagForm.param.failReson.$invalid}">
          <textarea style="width: 300px;height: 100px;" ng-model="param.failReson" required="required"></textarea>
        </div> 
        <div class="form-group" >
          <input type="submit" class="btn btn-block btn-primary" value="保存" />
        </div>
      </form>
    </div>
  </div>
</div> 


<div class="layer-box" ng-show="showPublishFailFormFlag">
  <div class="layer-bg"></div>
  <div class="layer-con " style="padding:10px 20px;">
    <span class="icons-close" title="关闭" ng-click="showPublishFailFormFlag = false;">X</span>
    <ul style="text-align: left;">
      <li>
          <input type="radio" name="failReson2" ng-click="param.failReson2='资料信息不全无法上架'" />资料信息不全无法上架
      </li>
      <li>
          <input type="radio" name="failReson2" ng-click="param.failReson2='产品募集进度已满'" />产品募集进度已满
      </li>
      <li>
        <input type="radio" name="failReson2" ng-click="param.failReson2='用户放弃承销权'" />用户放弃承销权
      </li>
    </ul>
    <div class="layer-title" >
      失败原因
    </div>
    <div class="con-wrap">
      <form class="form-horizontal" role="form" name="estagForm" novalidate ng-submit="changeStatus(pId,6)">
        <div class="form-group" ng-class="{'has-error':estagForm.param.failReson2.$invalid}">
          <textarea style="width: 300px;height: 100px;" ng-model="param.failReson2" required="required"></textarea>
        </div> 
        <div class="form-group" >
          <input type="submit" class="btn btn-block btn-primary" value="保存" />
        </div>
      </form>
    </div>
  </div>
</div>


<div class="layer-box" ng-show="showResonFlag">
  <div class="layer-bg"></div>
  <div class="layer-con " style="padding:10px 20px;">
    <span class="icons-close" title="关闭" ng-click="showResonFlag = false;">X</span>
    <div class="con-wrap">
         {{showResonfailReson}}
    </div>
  </div>
</div> 